<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../lib/OSL/layui/css/layui.css">
    <link rel="stylesheet" href="../lib/css/page/device_cate_manage.css">
    <title>Document</title>
</head>

<body>
    <!-- 卡片区域 -->
    <div class="layui-card">
        <div class="layui-card-header">
            <span>楼栋信息管理</span>
            <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="addCate">添加楼栋</button>
        </div>

        <div class="layui-card-body">
            <!-- //数据区 -->
            <table class="layui-table">
                <colgroup>
                    <col />
                    <col />
                    <col />
                    <col />
                    <col width="200" />
                </colgroup>
                <thead>
                    <tr>
                        <th>楼栋名称</th>
                        <th>管理员</th>
                        <th>联系电话</th>
                        <th>楼栋类型</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
            <!-- //分页区域 -->
            <div id="pageBox"></div>
        </div>
    </div>
    <!------------------------------------------------------------------ -->
    <!-- 获取分类列表 -->
    <script type="text/html" id="tpl_cateList">
        {{each data}}
        <tr>
            <th>{{$value.cate_name}}</th>
            <th>{{$value.admin_user}}</th>
            <th>{{$value.phone}}</th>
            <th>{{$value.lou_type}}</th>
            <th>
                <button type="button" class="layui-btn layui-btn-sm btn_editCate" data_id="{{$value.id}}">编辑</button>
                <button type="button" class="layui-btn layui-btn-danger layui-btn-sm btn_deleteCate"
                    data_id="{{$value.id}}">删除</button>
            </th>
        </tr>
        {{/each}}
    </script>
    <!-- ---------------------------------------------------------------- -->
    <!-- 添加新楼dialog -->
    <script type="text/html" id="tpl_dialog_addCate">
        <form class="layui-form" id="form_addCate">
            <div class="layui-form-item">
                <label class="layui-form-label">楼栋名称</label>
                <div class="layui-input-block">
                    <input type="text" name="cate_name" required lay-verify="required" placeholder="请输入楼栋名称"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">楼栋管理员</label>
                <div class="layui-input-block">
                    <select name="admin_user" lay-verify="required">
                        <option value=""></option>
                        {{each}}
                        <option value="{{$value.username}}">{{$value.username}}</option>
                        {{/each}}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">管理员电话</label>
                <div class="layui-input-block">
                    <input type="text" name="phone" required lay-verify="required|phone" placeholder="请输入负责人电话"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">楼栋类型</label>
                <div class="layui-input-block">
                    <select name="lou_type" lay-verify="required">
                        <option value=""></option>
                        {{each}}
                        <option value="{{$value.lou_type}}">{{$value.lou_type}}</option>
                        {{/each}}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">确认添加</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </script>
    <!-- ---------------------------------------------------------------- -->
    <!-- 根据id获取并修改楼栋信息 -->
    <script type="text/html" id="tpl_dialog_editCate">
        <form class="layui-form" id="form_editCate" lay-filter="form_edit">
            <input type="hidden" name="id">
            <div class="layui-form-item">
                <label class="layui-form-label">楼栋名称</label>
                <div class="layui-input-block">
                    <input type="text" name="cate_name" required lay-verify="required" placeholder="请输入分类名称"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">楼栋管理员</label>
                <div class="layui-input-block">
                    <select name="admin_user" lay-verify="required">
                        <option value=""></option>
                        {{each}}
                        <option value="{{$value.username}}">{{$value.username}}</option>
                        {{/each}}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">管理员电话</label>
                <div class="layui-input-block">
                    <input type="text" name="phone" required lay-verify="required|phone" placeholder="请输入负责人电话"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">楼栋类型</label>
                <div class="layui-input-block">
                    <select name="lou_type" lay-verify="required">
                        <option value=""></option>
                        <option value="男生楼">男生楼</option>
                        <option value="女生楼">女生楼</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">确认修改</button>
                </div>
            </div>
        </form>
    </script>


    <script src="../lib/OSL/jquery.js"></script>
    <script src="../lib/OSL/layui/layui.all.js"></script>
    <script src="../lib/js/baseAPI.js"></script>
    <script src="../lib/OSL/template-web.js"></script>
    <script src="../lib/js/page/device_cate_manage.js"></script>



</body>

</html>